package org.nepu.scr.indexrate.converter.drillingrate.keydevice.wellcontrolsystem;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.keydevice.wellcontrolsystem.GasSeparator;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class GasSeparatorConverter implements AttributeConverter<GasSeparator, String> {
    @Override
    public String convertToDatabaseColumn(GasSeparator gasSeparator) {
        return JSONUtil.toJsonStr(gasSeparator);
    }

    @Override
    public GasSeparator convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, GasSeparator.class);
    }
}
